<template name="addDaily">
<view class="bgzd">
	<view class="form">
		<view class="form_top">
			<text>添加支出</text>
			<image @click="close" src="/static/img/none_close.png"></image>
		</view>
		
		<view class="page_input" style="padding-top:10rpx;margin-top:10rpx;">
		    <view class="weui-cells__title width20" style="font-size:16px;">支出项目:</view>
		    <view class="width60">
		        <view class="weui-cell weui-cell_input">
					<input class="weui-input" type="text" v-model="item.title"
					placeholder-class="placeholderClass" placeholder="请输入支出项目">
				</view>
		    </view>
		</view>
		<view class="page_input" style="padding-top:10rpx;margin-top:10rpx;">
		    <view class="weui-cells__title width20" style="font-size:16px;">支出金额:</view>
		    <view class="width60">
		        <view class="weui-cell weui-cell_input">
					<input class="weui-input" type="text" v-model="item.price"
					placeholder-class="placeholderClass" placeholder="请输入支出金额">
				</view>
		    </view>
		</view>
		<button v-if="addTrue" @click="add" class="strue">添加</button>
	</view>
</view>
</template>
<script>
import request from '@/util/request.js'
export default {
	name: "addDaily",
	data() {
		return {
			addTrue:true,
			item:{
				title:'',
				price:''
			}
		}
	},
	//组件生命周期
	created:function(){
		
	},
	methods:{
		close:function(){
			this.$emit('func',{})
		},
		add:function(){
			if(!this.item.title){
				uni.showToast({
					title: '请填写支出项目!!!',
					icon: "none", 
					position:'bottom',
				});
				return;
			}
			if(!this.item.price){
				uni.showToast({
					title: '请填写支出金额!!!',
					icon: "none", 
					position:'bottom',
				});
				return;
			}
			
			this.addTrue = false
			this.item.oa_id = uni.getStorageSync('oa_id')

			var that = this
			request({
				url: 'manage/daily/add',
				method: 'post',
				data:this.item,
				success: (res) => {
					if(res.data.code == 1){
						uni.showToast({
							title: '添加成功!!!',
							icon: "none", 
							position:'bottom',
						});
						that.$emit('func',{})
					}else{
						uni.showToast({
							title: '添加失败!!!',
							icon: "none", 
							position:'bottom',
						});
					}
				},
			})
		}
	},
}
</script>
<style>
.bgzd{
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.4);
	z-index:999;
}
.form{
    padding-top:20rpx;
    padding-left:2%;
    width:100%;
    height:35%;
    bottom:0;
    padding-bottom: 20rpx;
    background:#d9d9d9;
    position: fixed;
    z-index:9999;
}
.form_top{
    font-weight:bold;
    font-size:20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width:95%;
}
.form_top image{
    width:35rpx;height:35rpx;
    margin-right: 20rpx;
}
.page_input{
	width:100%;
	justify-content: flex-start;
	align-items: center;
    height:40px;
	display: flex;
	padding:10rpx 0 5rpx 15rpx;
	border-bottom: 1rpx solid #c0c0c0;
}
.width20{
	width:20%;
	font-size:16px;
}
.width60{
	width:70%;
}
.form_footer{
    width:95%;
    margin-top:60rpx;
}
.strue{
	width:88%;
	margin-left:5%;
	height:80rpx;
	line-height:80rpx;
	background:#ff861a;
	color:#fff;
	margin-top:50rpx;
}
.frame_img{
	width:250rpx;height:200rpx;
	border:1rpx dashed #000000;
}
.radioClass{
	display:flex;
	flex-direction: row;
	justify-content:flex-start;
}
.row{
	display:flex;
	flex-direction: row;
	justify-content:flex-start;
}
.marginLeft20{margin-left:20px;}
</style>